<?php 
include_once("../public/head.php");
$a = isset($_GET['keywords'])?$_GET['keywords']:"";
@mysql_connect('localhost', 'root', 'root');
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql = "select * from `homeusers` where `uname` like '%$a%'";
$res = mysql_query($sql);
while ($rows = mysql_fetch_assoc($res)) {
    $arr[] = $rows;
}
if (!isset($arr)) {
    die( "<script>alert('没有找到');window.location.href='index.php'</script>");
}
 ?>

<div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="../index.php">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">用户管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action="index.php" method="get">
                    <table class="search-tab">
                        <tr>
                          
                            <th width="70">关键字:</th>
                            <td><input class="common-text" placeholder="关键字" name="keywords" value="" id="" type="text"></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="add.php"><i class="icon-font"></i>新增用户</a>
                       
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th class="tc" width="5%"><input class="allChoose" name="" type="checkbox"></th>
                            <th>ID</th>
                            <th>用户名</th>
                            <th>密码</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                  <?php    
                        foreach ($arr as $v) {
                       echo '<tr>
                            <td class="tc"><input name="id[]" value="59" type="checkbox"></td>
                            <td>'.$v['id'].'</td>
                            <td>'.$v['uname'].'</td>
                            <td>'.$v['pwd'].'</td>
                            <td>'.$v['state'].'</td>
                            <td>
                                <a class="link-update" href=update.php?id='.$v['id'].'&name='.$v['uname'].'&pwd='.$v['pwd'].'&state='.$v['state'].'>修改</a>
                                <a class="link-del" href=del.php?id='.$v['id'].'>删除</a>
                            </td>
                        </tr>' ;
                    } 
                 ?>      
                    </table>
                    <div class="list-page"> 1 条 1/1 页</div>
                </div>
            </form>
        </div>
    </div>



 <?php 
include_once("../public/after.php");

 ?>